﻿using System;
using System.Activities;
using System.Collections.Generic;
using KPIS.GERP.SERVICE.Model;

namespace KPIS.GERP.SERVICE.WorkflowService.CodeActivity
{

    public sealed class Select_MessageWarning : CodeActivity<List<message_warning>>
    {
        // Define an activity input argument of type string
        public InArgument<string> in_message_seq { get; set; }
        public InArgument<string> in_message_type { get; set; }

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override List<message_warning> Execute(CodeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            List<message_warning> list = new DAL.MessageWarning().GetMessageWarning(
                in_message_seq.Get(context)
                , in_message_type.Get(context)
                );
            return list;
        }
    }

    public sealed class Add_MessageWarning : System.Activities.CodeActivity
    {
        // Define an activity input argument of type string
        public InArgument<string> in_message { get; set; }
        public InOutArgument<List<string>> in_list_message { get; set; }

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(CodeActivityContext context)
        {
            //var msg = in_message.Get(context);
            //var list_message = in_list_message.Get(context);

            //if (list_message != null)
            //{
            //    list_message.Add(msg);
            //}
            //else { 
              
            //}
           
                in_list_message.Get(context).Add(in_message.Get(context));
          
           
           // context.SetValue(in_list_message, list_message);
            //// Obtain the runtime value of the Text input argument
            //in_list_message.Get(context).Add(in_message.Get(context));
           // var list_msg = in_list_message.Get(context);
           //// if (in_message.Get(context) != null)
           //// {
           //     list_msg.Add(in_message.Get(context));
           //// }
           //     context.SetValue(in_list_message,list_msg);
        }
    }

    //public sealed class Add_MessageWarning : System.Activities.CodeActivity
    //{
    //    // Define an activity input argument of type string
    //    public InArgument<string> in_message { get; set; }
    //    public InOutArgument<List<string>> in_list_message { get; set; }

    //    // If your activity returns a value, derive from CodeActivity<TResult>
    //    // and return the value from the Execute method.
    //    protected override void Execute(CodeActivityContext context)
    //    {
    //        // Obtain the runtime value of the Text input argument
    //       in_list_message.Get(context).Add(in_message.Get(context));
            
    //       // return in_list_message.Get(context).Add(in_message.Get(context));
    //    }
    //}

}
